<?php
namespace app\admin\validate;
use think\Validate;
class Article extends Validate
{
    protected $rule = [
        'title'  =>  'require|unique:article|min:4',
        'cate_id'  =>  'require',

    ];

    protected $message = [
        'title.require'  =>  '标题名称必须填写',
        'title.unique' =>  '标题名称不能重复',
        'title.min' =>  '标题名称要四个字符以上',
        'cate_id.require' =>  '栏目名称必须填写',

    ];
    protected $scene = [
        //'edit'  =>  ['name','age'],
    ];


    // 自定义验证规则
    protected function checkName($value,$rule,$data)
    {
        return $rule == $value ? true : '名称错误';
    }
}
